home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / chatter / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.7 KB  |  115 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1999 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "chatter.h"
  15.  
  16. #include "mainfrm.h"
  17. #include "chatdoc.h"
  18. #include "chatvw.h"
  19. #include "sendvw.h"
  20.  
  21. #ifdef _DEBUG
  22. #undef THIS_FILE
  23. static char BASED_CODE THIS_FILE[] = __FILE__;
  24. #endif
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CMainFrame
  28.  
  29. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  30.  
  31. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  32.     //{{AFX_MSG_MAP(CMainFrame)
  33.         // NOTE - the ClassWizard will add and remove mapping macros here.
  34.         //    DO NOT EDIT what you see in these blocks of generated code !
  35.     ON_WM_CREATE()
  36.     //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38.  
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CMainFrame construction/destruction
  42.  
  43. CMainFrame::CMainFrame()
  44. {
  45. }
  46.  
  47. CMainFrame::~CMainFrame()
  48. {
  49. }
  50.  
  51. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  52. {
  53.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  54.         return -1;
  55.  
  56. #if (_WIN32_WCE > 200)
  57.     if(!m_wndCommandBar.Create(this) ||
  58.        !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
  59.        !m_wndCommandBar.AddAdornments())
  60.     {
  61.         TRACE0("Failed to create CommandBar\n");
  62.         return -1;      // fail to create
  63.     }
  64. #else // MFC for Windows CE 1.0 and 2.0
  65.     if(!AddAdornments(0))
  66.     {
  67.         TRACE0("Failed to create CommandBar\n");
  68.         return -1;      // fail to create
  69.     }
  70. #endif
  71.  
  72.     return 0;
  73. }
  74.  
  75. BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
  76.     CCreateContext* pContext)
  77. {
  78.     if (m_wndSplitter.CreateStatic(this,2,1))
  79.     {
  80.         CRect rect;
  81.         GetClientRect(&rect);
  82.         CSize size = rect.Size();
  83.         size.cy-=150;
  84.         if (m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CChatView),size,pContext))
  85.         {
  86.             if (m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CSendView),CSize(0,0),pContext))
  87.             {
  88.                 SetActiveView((CView*)m_wndSplitter.GetPane(1,0));
  89.                 return TRUE;    
  90.             }
  91.         }
  92.     }
  93.     return FALSE;
  94. }
  95.  
  96. /////////////////////////////////////////////////////////////////////////////
  97. // CMainFrame diagnostics
  98.  
  99. #ifdef _DEBUG
  100. void CMainFrame::AssertValid() const
  101. {
  102.     CFrameWnd::AssertValid();
  103. }
  104.  
  105. void CMainFrame::Dump(CDumpContext& dc) const
  106. {
  107.     CFrameWnd::Dump(dc);
  108. }
  109.  
  110. #endif //_DEBUG
  111.  
  112. /////////////////////////////////////////////////////////////////////////////
  113. // CMainFrame message handlers
  114.  
  115.